<?php /*a:1:{s:27:"D:\tp\view\loginController\index.html";i:1651722676;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<form id="login">
    账号:
    <input type="text"  value="admin" name="username"><span id="usernametip"></span><br/>
    密码:
    <input type="password" value="123456" name="password"><span id="passwordtip"></span><br/>
    <input type="text"  autocomplete="off" name="verifycode" placeholder="请输入验证码">
    <div id="yzm"><?php echo captcha_img(); ?></div>
    <input type="submit" value="登录" id="submit">
</form>
<script>
    var login = document.getElementById('login')
    var submit = document.getElementById('submit')
    var yzm = document.getElementById('yzm')
    var yamimg = yzm.getElementsByTagName('img')
    console.log(yamimg)
    login.addEventListener('submit',function (e){

        e.preventDefault()
    })
    submit.addEventListener('click', async () =>{
        var username = login.username.value
        var password = login.password.value
        var verifycode = login.verifycode.value
        const {data:result} = await axios.post('login/login',{username,password,verifycode})
        alert(result.message)
        window.location.reload()

    })

</script>
</body>
</html>